/**************************************************************************************************
  Filename:       epl_automation.h
  Revised:        $Date: 2010-08-06 08:56:11 -0700 (Fri, 06 Aug 2010) $
  Revision:       $Revision: 23333 $ TONG KUN LAI

  Description:    This file contains the Simple GATT profile definitions and
                  prototypes.
**************************************************************************************************/

#ifndef EPL_AUTOMATION_H
#define EPL_AUTOMATION_H

#ifdef __cplusplus
extern "C"
{
#endif

/*********************************************************************
 * INCLUDES
 */

/*********************************************************************
 * CONSTANTS
 */

// Profile Parameters
#define epl_automation_CHAR1                   0  // RW uint8 - Profile Characteristic 1 value 
#define epl_automation_CHAR2                   1  // RW uint8 - Profile Characteristic 2 value
#define epl_automation_CHAR3                   2  // RW uint8 - Profile Characteristic 3 value
#define epl_automation_CHAR4                   3  // RW uint8 - Profile Characteristic 4 value
#define epl_automation_CHAR5                   4  // RW uint8 - Profile Characteristic 5 value
#define epl_automation_CHAR6                   5  // RW uint8 - Profile Characteristic 6 value
#define epl_automation_CHAR7                   6  // RW uint8 - Profile Characteristic 7 value
#define epl_automation_CHAR8                   7  // RW uint8 - Profile Characteristic 8 value
#define epl_automation_CHAR9                   8  // RW uint8 - Profile Characteristic 9 value
#define epl_automation_CHAR10                  9  // RW uint8 - Profile Characteristic 10 value
#define epl_automation_CHAR11                  10 // RW uint8 - Profile Characteristic 11 value
  
// Simple Profile Service UUID
#define epl_automation_SERV_UUID               0xFFB0
    
// Key Pressed UUID
#define epl_automation_CHAR1_UUID            0xFFB1 // power
#define epl_automation_CHAR2_UUID            0xFFB2 // bringhtness
#define epl_automation_CHAR3_UUID            0xFFB3 // 10 ths of second
#define epl_automation_CHAR4_UUID            0xFFB4 // 100 ths of second
#define epl_automation_CHAR5_UUID            0xFFB5 // second
#define epl_automation_CHAR6_UUID            0xFFB6 // minute
#define epl_automation_CHAR7_UUID            0xFFB7 // hour
#define epl_automation_CHAR8_UUID            0xFFB8 // year
#define epl_automation_CHAR9_UUID            0xFFB9 // month
#define epl_automation_CHAR10_UUID           0xFFBA // day
#define epl_automation_CHAR11_UUID           0xFFBB // alarm interrupt flag
  
// Simple Keys Profile Services bit fields
#define epl_automation_SERVICE               0x00000001

// Length of Characteristic 5 in bytes
//#define epl_automation_CHAR5_LEN           5  


  
  
/*********************************************************************
 * TYPEDEFS
 */

  
/*********************************************************************
 * MACROS
 */

/*********************************************************************
 * Profile Callbacks
 */

// Callback when a characteristic value has changed
//typedef NULL_OK void (*epl_automationChange_t)( uint8 paramID );
typedef NULL_OK void (*epl_automationChange_t)( void );

typedef struct
{
  epl_automationChange_t        pfnepl_automationChange;  // Called when characteristic value changes
} epl_automationCBs_t;

    

/*********************************************************************
 * API FUNCTIONS 
 */


/*
 * SimpleProfile_AddService- Initializes the Simple GATT Profile service by registering
 *          GATT attributes with the GATT server.
 *
 * @param   services - services to add. This is a bit map and can
 *                     contain more than one service.
 */

extern bStatus_t epl_automation_AddService( uint32 services );

/*
 * SimpleProfile_RegisterAppCBs - Registers the application callback function.
 *                    Only call this function once.
 *
 *    appCallbacks - pointer to application callbacks.
 */
extern bStatus_t epl_automation_RegisterAppCBs(epl_automationCBs_t *appCallbacks );

/*
 * SimpleProfile_SetParameter - Set a Simple GATT Profile parameter.
 *
 *    param - Profile parameter ID
 *    len - length of data to right
 *    value - pointer to data to write.  This is dependent on
 *          the parameter ID and WILL be cast to the appropriate 
 *          data type (example: data type of uint16 will be cast to 
 *          uint16 pointer).
 */
extern bStatus_t epl_automation_SetParameter( uint8 param, uint8 len, void *value );
  
/*
 * SimpleProfile_GetParameter - Get a Simple GATT Profile parameter.
 *
 *    param - Profile parameter ID
 *    value - pointer to data to write.  This is dependent on
 *          the parameter ID and WILL be cast to the appropriate 
 *          data type (example: data type of uint16 will be cast to 
 *          uint16 pointer).
 */
extern bStatus_t epl_automation_GetParameter( uint8 param, void *value );


/*********************************************************************
*********************************************************************/

#ifdef __cplusplus
}
#endif

#endif /* EPL_AUTOMATION_H */
